package com.hmall.hmallapi.api;

import com.hmall.hmallapi.config.DefaultFeignConfig;
import com.hmall.hmallapi.dto.ItemDTO;
import com.hmall.hmallapi.dto.OrderDetailDTO;
import com.hmall.hmallapi.fallback.ItemServiceFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;

/**
 * @author malty
 */
@FeignClient(name = "item-service", configuration = DefaultFeignConfig.class,fallbackFactory = ItemServiceFallBack.class )
public interface ItemService {
    /**
     * @param itemIds
     * @return
     */
    @GetMapping("/items")
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> itemIds);

    @PutMapping("/items/stock/deduct")
    void deductStock(List<OrderDetailDTO> detailDTOS);
}
